package org.dromara.system.dubbo;


import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.system.api.RemoteMessageService;
import org.dromara.system.api.domain.bo.RemoteMessageBo;
import org.dromara.system.domain.bo.SysMessageBo;
import org.dromara.system.service.ISysMessageService;
import org.springframework.stereotype.Service;

import java.rmi.ServerException;
import java.util.List;

/**
 * 用户服务
 *
 * @author Lion Li
 */
@RequiredArgsConstructor
@Service
@DubboService
public class RemoteMessageServiceImpl implements RemoteMessageService {

    private final ISysMessageService sysMessageService;

    /**
     * 新增系统管理-消息通知
     *
     * @param bo
     */
    @Override
    public Boolean insertByBo(RemoteMessageBo bo) throws ServerException {
        SysMessageBo sysMessageBo = BeanUtil.copyProperties(bo, SysMessageBo.class);
        return sysMessageService.insertByBo(sysMessageBo);
    }

    @Override
    public void insertBatchByBo(List<RemoteMessageBo> handlerMessageList) {
        sysMessageService.insertBatchByBo(handlerMessageList);
    }
}
